import java.util.*;

/**
 * @author LKQ
 * @date 2022/4/23 15:07
 * @description
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int numSub(String s) {
        // 思路，统计连续1的个数，贡献为 n * (n + 1 ) / 2
        int r = 0;
        char[] c = s.toCharArray();
        long ans = 0, MOD = (int) (1e9 + 7);
        while (r < c.length) {
            long cnt = 0;
            while (r < c.length && c[r] == '1') {
                r++;
                cnt++;
            }
            ans += cnt * (cnt + 1) / 2;
            ans %= MOD;
            r++;
        }
        return (int) ans;
    }
}
